<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
	a.thua__link_1:link { font-size: 14px; text-decoration: none;  color: #0b55c4; }
	a.thua__link_1:visited { font-size: 14px; color: #0b55c4; text-decoration: none; }
	a.thua__link_1:hover { font-size: 14px; text-decoration: none; color: #084095;  font-style: normal; }
</style>
<?php
	//Tinh so trang dua vao so hang hoa gioi han 
	function tinh_so_trang($so_gioi_han)
		{
			$sql="select count(*) from dm_hang";
			$sql1=mysql_query($sql);
			$data=mysql_fetch_row($sql1);
			$st=ceil($data[0]/$so_gioi_han);
			return $st;
		}
	$ssp_td=1;
	$sd=15;
	$so_gioi_han=$ssp_td*$sd;
	if($_GET['trang']=="")
	{
		$vtbd=0;
	}
	else 
	{
		$vtbd=($_GET['trang']-1)*$so_gioi_han;
	}
	$st=tinh_so_trang($so_gioi_han);
?>
<a href="?thamso=themhang"><input type="button" value="Thêm hãng máy" style="height:30px; width:200px"/></a>
<center>

  <table width="990px" border="1" style="margin-top:6px" id="er">
  <tr>
			<td width="100" align="center"><b>ID Hãng</b></td>
			<td width="538" align="center"><b>Tên sản hãng</b></td>
            <td width="161" align="center"><b>Sửa</b></td>
			<td width="163" align="center"><b>Xóa</b></td>
		</tr>
		<?php 
			//Cac chuc nang them, xoa, sua san xuat may tinh
			$sql="select * from dm_hang order by idh desc limit $vtbd,$so_gioi_han";
			$sql1=mysql_query($sql);
			while($tv_2=mysql_fetch_array($sql1))
			{
				//Khai bao chuc nang sua thong tin nha san xuat
				$link_sua="?thamso=suah&id=".$tv_2['idh'];
				//Khai bao chuc nang xoa thong tin nha san xuat
				$link_xoa="?thamso=xoah&id=".$tv_2['idh'];
				?>
					<tr>
						<td align="center" >
							<a href="<?php echo $link_sua; ?>" class="thua__link_1">
								<?php echo $tv_2['idh']; ?>
							</a>
                            <input type="hidden" name="idh_cc" value="<?php echo $tv_2['idh']; ?>" />
						</td>
						<td align="center" >
						<?php echo $tv_2['tenhang']; ?></td>
						<td align="center">
							<a href="<?php echo $link_sua; ?>" class="sua_xoa" >
								Sửa
							</a>
						</td>
						<td align="center">
							<a href="<?php echo $link_xoa; ?>" class="sua_xoa" >
								Xóa
							</a>
						</td>
					</tr>
				<?php
			}
		?>
		
	</table>
      		<?php
			echo "<div id='trang'>";
		for($i=1;$i<=$st;$i++)
		{
			$link="?thamso=hang&trang=$i";
			echo "<a href='$link' class='hello'><font size='4px'>";
			echo $i;
			echo "</font></a>";echo"  ";
		}
	echo "</div>";
		?>
        <div style="height:10px"></div>
</center>
</center>
<script>
	table_css_2("er");
</script>